package cn.tradewin.common.util;

import java.util.ArrayList;
import java.util.List;

import org.apache.tapestry5.OptionGroupModel;
import org.apache.tapestry5.OptionModel;
import org.apache.tapestry5.internal.OptionModelImpl;
import org.apache.tapestry5.util.AbstractSelectModel;

import cn.tradewin.common.model.SelectOption;

public class SelectModelUtil extends AbstractSelectModel {
	
	private List<SelectOption> options;

	public SelectModelUtil(List<SelectOption> options) {
		this.options = options;
	}

	public List<OptionGroupModel> getOptionGroups() {
		return null;
	}

	public List<OptionModel> getOptions() {
		List<OptionModel> list = new ArrayList<OptionModel>();
		for (SelectOption option : options) {
			list.add(new OptionModelImpl( option.getLabel(), option.getValue()));
		}
		return list;
	}
}
